package com.suyi.controller;


import com.suyi.domain.CommonResult;
import com.suyi.service.TStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 贺袁晨
 * @since 2021-04-28
 */
@RestController
public class TStorageController {

    @Autowired
    private TStorageService storageService;

    /**
     * 扣减库存
     */
    @RequestMapping(value = "/storage/decrease",method = RequestMethod.POST)
    public CommonResult decrease(@RequestParam("productId") Long productId, @RequestParam("count") Integer count) {
        storageService.decrease(productId, count);
        return new CommonResult(200,"扣减库存成功！");
    }
}

